package com.qingbo.wu.oss.adapter;

import com.qingbo.wu.oss.entity.FileInfo;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.List;

/**
 * minio 文件存储适配器
 * @Auther: qingbo.wu
 * @Date: 2024/6/1 16:36
 * @Description:
 */
public interface StorageAdapter {


    /**
     * 创建bucket桶
     * @param bucket
     * @throws Exception
     */
    void createBucket(String bucket);

    /**
     * 上传文件
     * @param bucket
     * @throws Exception
     */
    void uploadFile(MultipartFile uploadFile, String bucket, String objectName);


    /**
     * 获取所有bucket桶
     * @return
     */
    List<String> getAllBuckets();

    /**
     * 获取当前bucket桶及文件
     * @return
     */
    List<FileInfo> getAllFile(String bucket);

    /**
     * 下载文件
     * @param bucket
     * @param objectName
     * @return
     * @throws Exception
     */
    InputStream downLoad(String bucket,String objectName);

    /**
     * 删除桶
     * @param bucket
     * @throws Exception
     */
    void deleteBucket(String bucket);

    /**
     * 删除文件
     * @param bucket
     * @throws Exception
     */
    void deleteFile(String bucket,String objectName);

}
